import cv2


img = cv2.imread('img.png')

img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

ret, th = cv2.threshold(img_gray, 100, 255, cv2.THRESH_BINARY)

cv2.imshow('pic', th)
cv2.waitKey()
cv2.destroyAllWindows()
